<?php

namespace app\index\model;

use frame\lib\Db;

class Article
{
    public static function list($where, $query)
    {
        $uid = $_SESSION['user']['id'];
        $where['user_id'] =   $uid;
        $where['delete_time'] = 0;
        if ($query) {
            $list = Db::name('article')->where(['user_id' => $uid, 'delete_time' => 0])->like('title', "%$query%")->select();
        } else {
            $list = Db::name('article')->where($where)->select();
        }
        return $list;
    }
}
